package com.zhou.cloud.producer.controller;

import com.zhou.cloud.producer.service.KafkaProducerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @descrition:
 * @author: zhouyongjun
 * @date: 2022/7/28
 **/

@RestController
public class KafkaProducerController {
    @Autowired
    KafkaProducerService service;
    // 发送消息
    @GetMapping("/kafka/sendMessage/{message}")
    public void sendMessage(@PathVariable("message") String normalMessage) {
        service.sendMessage(normalMessage);
    }
    @GetMapping("/kafka/sendMessageCallBack/{message}")
    public void sendMessageCallBack(@PathVariable("message") String normalMessage) {
        service.sendMessageCallBack(normalMessage);
    }
    @GetMapping("/kafka/sendMessageCallBack2/{message}")
    public void sendMessageCallBack2(@PathVariable("message") String normalMessage) {
        service.sendMessageCallBack2(normalMessage);
    }

    @GetMapping("/kafka/sendMessageInTransaction/{message}")
    public void sendMessageInTransaction(@PathVariable("message") String normalMessage) {
        service.sendMessageInTransaction(normalMessage);
    }
}
